Paging = function(options){
	var _options =$.extend({},this._options,options);
	$.extend(this,{
		_options:_options
	});
	this._init();
};
Paging.prototype = {
		_options:{
			size:15,
			url:null,
		},
		data:null,
		size:null,
		index:null,
		rows:null,
		last:null,
		first:null,
		prev:null,
		next:null,
		_init:function(){
			this.size = this._options.size;
			this.index =1;
			this.rows = 0;
			this.data = {};
			
			this._calculate();
		},
		_calculate:function(){
			this.last = Math.ceil(this.rows/this.size);
			this.first = this.rows >0?1:0;
			this.prev = this.index>this.first?this.index-1:0;
			this.next = this.index<this.last?this.index+1:this.last;
		},
		to:function(index){
			if((index>=this.first && index<=this.last) || index==1){
				this.index = index;
				this.paging();
			}
		},
		toFirst:function(){
			this.to(this.first);
		},
		toLast:function(){
			this.to(this.last);
		},
		toPrev:function(){
			this.to(this.prev);
		},
		toNext:function(){
			this.to(this.next);
		},
		search:function(params){
			$.extend(this.data,params);
			this.toFirst();
		},
		paging:function(){
			new Ajax({
				url:this._options.url,
				data:this.data,
				success:function(response){
					
				}
			});
		},
		render:function(){
			
		},
		setSize:function(size){
			this.size = size;
			this.paging();
		},
		go:function(index){
			if(!isNaN(index)){
				index = parseInt(index);
				if(index>=0) this.to(index);
			}
		}
};